/* TCSS 590A - Cybernetics and Systems
 * Group Project - Modeling
 * By Barry Jones, Naren Meadem, Michael Pitts, Yuan Tao
 * Fall 2012, University of Washington, Tacoma
 */
package model;

import output.OutPut;


/**
 * A very simple model that outputs a line of strings.
 * @author Michael Pitts
 * @version Nov 13, 2012
 */
public class VeryDumbModel implements Model
{
	/** The data this model will output.*/
	private final String[] my_data;
	
	/** The output destination.*/
	private final OutPut my_out;
	
	/** The index in the data.*/
	private int my_index;
	
	/**
	 * Will, over time output the_data to the_output.
	 * @param the_data is the data you want to put out.
	 * @param the_output is the output.
	 */
	public VeryDumbModel(final String[] the_data, final OutPut the_output)
	{
		my_data = the_data.clone();
		my_out = the_output;
		my_index = 0;
	}

	@Override public boolean runOne()
	{
		if (my_index < my_data.length)
		{
			my_out.out(my_data[my_index]);
			my_out.delineate();
			my_index++;
			return true;
		} else
		{
			my_out.newLine();
			my_out.close();
			return false;
		}
	}
}
